package main

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
	"time"
)

func main() {
	cxt := context.Background()
	rdb := redis.NewClient(&redis.Options{
		//global.ServerConfig.RedisInfo.Host, global.ServerConfig.RedisInfo.Port
		Addr: fmt.Sprintf("%s:%d", "127.0.0.1", 6379),
	})
	rdb.Set(cxt, "mobile", "15011112222", time.Second*8)
	value, err := rdb.Get(cxt, "mobile").Result()
	if err == redis.Nil {
		fmt.Println("get redis panic")
		return
	}
	fmt.Println(value)
}
